/**
 * Copyright (c) 2013-Now http://jeesite.com All rights reserved.
 */
package com.jeesite.modules.goods.service;

import java.util.List;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeesite.common.entity.Page;
import com.jeesite.common.service.CrudService;
import com.jeesite.modules.file.utils.FileUploadUtils;
import com.jeesite.modules.goods.dao.BrandDao;
import com.jeesite.modules.goods.entity.Brand;
import com.jeesite.modules.goods.entity.ZtGoods;

/**
 * 测试数据Service
 * 
 * @author ThinkGem
 * @version 2018-04-22
 */
@Service
@Transactional(readOnly = true)
public class BrandService extends
		CrudService<BrandDao, Brand> {

	
	public Brand getByName(Brand brand) {
		return dao.getByName(brand);
	}
	@Transactional(readOnly = false)
	public void batchSave(List<Brand> brandList) {
		dao.batchSave(brandList);
		
	}
	/**
	 * 获取单条数据
	 * 
	 * @param testData
	 * @return
	 */
	@Override
	public Brand get(Brand brand) {
		Brand entity = super.get(brand);
		if (entity == null) {
			entity = new Brand();
		}
		return entity;
	}

	/**
	 * 查询分页数据
	 * 
	 * @param page
	 *            分页对象
	 * @param testData
	 * @return
	 */
	@Override
	public Page<Brand> findPage(Page<Brand> page,
			Brand brand) {
		return super.findPage(page, brand);
	}
	public List<Brand> getList() {
		return dao.getList();
	}
	
	

	/**
	 * 保存数据（插入或更新）
	 * 
	 * @param testData
	 */
	@Override
	@Transactional(readOnly = false)
	public void save(Brand brand) {
		super.save(brand);
		// 保存上传图片
		FileUploadUtils.saveFileUpload(brand.getId(), "user_upload2");
		FileUploadUtils.saveFileUpload(brand.getId(), "user_upload3");
	}

	/**
	 * 更新状态
	 * 
	 * @param testData
	 */
	@Override
	@Transactional(readOnly = false)
	public void updateStatus(Brand brand) {
		super.updateStatus(brand);
	}

	/**
	 * 删除数据
	 * 
	 * @param testData
	 */
	@Override
	@Transactional(readOnly = false)
	public void delete(Brand brand) {
		super.delete(brand);
	}

}